package com.dragon.concurrent.demo.join;

public class JoinTest {

    public static void main(String[] args) throws InterruptedException {
        Thread thread1 = new Thread(() -> {
            try {
                Thread.sleep(20000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println(Thread.currentThread().getName() + ":运行了");
        });
        Thread thread2 = new Thread(() -> {
            try {
                Thread.sleep(200);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println(Thread.currentThread().getName() + ":运行了");
        });
        thread1.start();
        thread2.start();
        thread2.join();
        thread1.join(200);
        System.out.println(Thread.currentThread().getName() + ":运行了");

    }
}
